package no.sachmuld.methodcombination.examples.reflection.clossimplestyle.around;

import no.sachmuld.methodcombination.api.MethodInvocation;

/**
 *
 */
public class Main implements Runnable {

    @Override
    public void run() {

        Foo foo = new Foo();

        foo.with(new PrimaryFooBehaviour() {
            @Override
            public int bar() {
                return 1;
            }
        });
        foo.with(new PrimaryFooBehaviour() {
            @Override
            public int bar() {
                return 2;
            }
        });
        foo.with(new AroundFooBehaviour() {
            @Override
            public int aroundBar(MethodInvocation<Integer> methodInvocation) {
                return -methodInvocation.proceed();
            }
        });

        System.out.println(foo.bar());

    }

    public static void main(String... args) {

        new Main().run();

    }
}
